<?
imageinterlace($im, true);
 header('Content-Type: image/JPEG');
$ss =file_get_contents("time.txt");
if($ss !==date("Y-m-d"))
{
    $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
	if(preg_match("/<url>(.+?)<\/url>/ies",$str,$matches)){
		$url='http://cn.bing.com'.$matches[1];}
date_default_timezone_set("Asia/Shanghai");
$fp_input = fopen($url, 'r');
file_put_contents('./img/'.date("Y-m-d").'.jpg', $fp_input);
exec("libreoffice ./img/".date("Y-m-d").".jpg", $out, $status);
file_put_contents("time.txt",date("Y-m-d"));
    $imgurl = "./img/".date("Y-m-d").".jpg";
    
    
        @ob_end_clean();
        @readfile($imgurl);
        @flush(); @ob_flush();
        exit();
}
else {
    imageinterlace($im, true);
    $imgurl = "./img/".date("Y-m-d").".jpg";
        @ob_end_clean();
        @readfile($imgurl);
        @flush(); @ob_flush();
        exit();
}
?>